import AccessControl from 'accesscontrol';

let grantObjects = {
    student: {
        course: {
            'read:any': ['*'],
        },
        homework: {
            'read:own': ['*'],
        },
        report: {
            'create:own': ['*'],
            'read:own': ['*'],
            'update:own': ['*'],
            'delete:own': ['*'],
        },
        score: {
            'read:any': ['*'],
        }
    },
    ta: {
        course: {
            'read:any': ['*'],
        },
        homework: {
            'read:own': ['*'],
        },
        report: {
            'create:own': ['*'],
            'read:own': ['*'],
            'update:own': ['*'],
            'delete:own': ['*'],
        },
        score: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:any': ['*'],
            'delete:any': ['*'],
        }
    },
    teacher: {
        course: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:own': ['*'],
            'delete:own': ['*'],
        },
        homework: {
            'create:own': ['*'],
            'read:own': ['*'],
            'update:own': ['*'],
            'delete:own': ['*'],
        },
        report: {
            'create:own': ['*'],
            'read:own': ['*'],
            'update:own': ['*'],
            'delete:own': ['*'],
        },
        score: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:any': ['*'],
            'delete:any': ['*'],
        },
    },
    admin: {
        course: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:any': ['*'],
            'delete:any': ['*'],
        },
        homework: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:any': ['*'],
            'delete:any': ['*'],
        },
        report: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:any': ['*'],
            'delete:any': ['*'],
        },
        score: {
            'create:any': ['*'],
            'read:any': ['*'],
            'update:any': ['*'],
            'delete:any': ['*'],
        },
    },
};

const AC = new AccessControl(grantObjects);
export default AC;
